<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <title>鼠标滚轮事件</title>
    <style>
        .list {
            width: 200px;
            height: 150px;
            background-color: chocolate;
            overflow: auto;
        }

        li {
            height: 60px;
        }
    </style>
</head>
<body>
<div id="app">
    <!--要求：滚轮向上滚动输出up，滚轮向下滚动输出 down-->
    <!--注意：鼠标滚轮事件没有修饰符-->
    <ul class="list" @wheel="scroll">
        <li>1</li>
        <li>2</li>
        <li>3</li>
        <li>4</li>
        <li>5</li>
    </ul>


    <hr>
    <ul class="list" @scroll="scroll">
        <li>1</li>
        <li>2</li>
        <li>3</li>
        <li>4</li>
        <li>5</li>
    </ul>

    <ul class="list" @wheel.passive="scroll">
        <li>1</li>
        <li>2</li>
        <li>3</li>
        <li>4</li>
        <li>5</li>
    </ul>
</div>

<script type="module">
    import {createApp} from "../../../js/vue.esm-browser.js";

    let app = createApp(
        {
            setup() {
                function scroll(event) {
                    // console.log(event);
                    if (event.deltaY < 0) {
                        console.log("up");
                    } else {
                        console.log("down");
                    }
                }

                return {
                    scroll,
                }
            }
        }
    );

    app.mount("#app")
</script>
</body>
</html>